home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-faltstrom-macmime1-00.txt < prev    next >
Text File  |  1993-10-15  |  17KB  |  453 lines

  1.  
  2. Network Working Group                                   Patrik Faltstrom
  3. Internet Draft: draft-faltstrom-macmime1-00                 Dave Crocker
  4. Expiration 4/94                                             Erik E. Fair
  5.                                                         October 15, 1993
  6.  
  7.              MIME Encapsulation of Macintosh files - MacMIME
  8.  
  9.  
  10.  
  11. 1.  Status of this Memo
  12.  
  13.    This document is an Internet Draft.  Internet Drafts are working
  14.    documents of the Internet Engineering Task Force (IETF), its Areas,
  15.    and its Working Groups.  Note that other groups may also distribute
  16.    working documents at any timne.  It is not appropriate to use
  17.    Internet Drafts as reference material or to cite them other than as
  18.    a "working draft" or "work in progress".  Please check the
  19.    1idabstracts.txt listing contained in the internet-drafts Shadow
  20.    Directories on nic.ddn.mil, nnsc.nsf.net, nic.nordu.net,
  21.    ftp.nisc.sri.com, or munnari.oz.au to learn the current status of
  22.    any Internet Draft.
  23.  
  24.  
  25. 2.  Abstract
  26.  
  27.    This memo describes the format to use when sending Apple Macintosh
  28.    files via MIME [BORE93].  The format is compatible with existing
  29.    mechanisms for distributing Macintosh files, while allowing
  30.    non-Macintosh systems access to data in standardized formats.
  31.  
  32.  
  33. 3.  Introduction
  34.  
  35.    Files on the Macintosh consists of two parts, called forks:
  36.  
  37.    Data fork:       The actual data included in the file.  The Data
  38.                     fork is typically the only meaningful part of a
  39.                     Macintosh file on a non-Macintosh computer system.
  40.                     For example, if a Macintosh user wants to send a
  41.                     file of data to a user on an IBM-PC, she would only
  42.                     send the Data fork.
  43.  
  44.    Resource fork:   Contains a collection of arbitrary attribute/value
  45.                     pairs, including program segments, icon bitmaps,
  46.                     and parametric values.
  47.  
  48.    Additional information regarding Macintosh files is stored by the
  49.    Finder has in a hidden file, called the "Desktop Database".
  50.  
  51.    Because of the complications in storing different parts of a
  52.    Macintosh file in a non-Macintosh filesystem that only handles
  53.    consecutive data in one part, it is common to convert the Macintosh
  54.  
  55. Faltstrom, Crocker, Fair                                        [Page 1]
  56.  
  57. Internet Draft            MIME-based Mac files          October 15, 1993
  58.  
  59.    file into some other format before transferring it over the network.
  60.  
  61.    The two styles of use are [APPL90]:
  62.  
  63.    AppleSingle:   Apple's standard format for encoding Macintosh files
  64.                   as one byte stream.
  65.    AppleDouble:   Similar to AppleSingle except that the Data fork is
  66.                   separated from the other parts of the Macintosh File.
  67.  
  68.    AppleDouble is the preferred format for a Macintosh file that is to
  69.    be included in an Internet mail message, because it provides
  70.    recipients with Macintosh computers the entire document, including
  71.    Icons and other Macintosh specific information, while other users
  72.    easily can extract the Data fork (the actual data) as it is
  73.    separated from the AppleDouble encoding.
  74.  
  75.  
  76. 4.  MIME format for Apple/Macintosh-specific file information
  77.  
  78.    4a.  APPLICATION/APPLEFILE
  79.  
  80.       MIME type-name:            APPLICATION
  81.       MIME subtype name:         APPLEFILE
  82.       Required parameters:       none
  83.       Optional parameters:       NAME, which must only consist of
  84.                                  seven-bit US-ASCII characters
  85.                                  excluding SPACE, CTLS, and
  86.                                  "tspecials" as defined in RFC-1521
  87.                                  [BORE93].
  88.       Encoding considerations:   The presence of binary data will
  89.                                  typically require use of
  90.                                  Content-Transfer-Encoding: BASE64
  91.       Security considerations:   See separate section in the document
  92.       Published specification:   Apple-single & Apple-double [APPL90]
  93.       Rationale:                 Permits MIME-based transmission of
  94.                                  data with Apple/Macintosh specific
  95.                                  information, while allowing general
  96.                                  access to non-specific user data.
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. Faltstrom, Crocker, Fair                                        [Page 2]
  112.  
  113. Internet Draft            MIME-based Mac files          October 15, 1993
  114.  
  115.    4b.  MULTIPART/APPLEDOUBLE
  116.  
  117.       MIME type-name:            MULTIPART
  118.       MIME subtype name:         APPLEDOUBLE
  119.       Required parameters:       none
  120.       Optional parameters:       NAME, which must only consist of
  121.                                  seven-bit US-ASCII characters
  122.                                  excluding SPACE, CTLS, and
  123.                                  "tspecials" as defined in RFC-1521
  124.                                  [BORE93].
  125.       Encoding considerations:   none
  126.       Security considerations:   See separate section in the document
  127.       Published specification:   Apple-single & Apple-double [APPL90]
  128.       Rationale:                 Permits MIME-based transmission of
  129.                                  data with Apple/Macintosh specific
  130.                                  information, while allowing general
  131.                                  access to non-specific user data.
  132.  
  133.  
  134.    4c.  Detail specific to MIME-based usage
  135.  
  136.       Macintosh documents do not always need to be sent in a special
  137.       format.  Those documents with well-known MIME types and
  138.       non-existent or trivial resource forks can be sent as regular
  139.       MIME body parts, without use of AppleSingle or AppleDouble.
  140.  
  141.       Documents which lack a data fork should always be sent as
  142.       AppleSingle.
  143.  
  144.       All other documents should normally sent as AppleDouble.  This
  145.       includes documents with non-trivial resource forks, and documents
  146.       without corresponding well-known MIME types.
  147.  
  148.       It may be valuable in some cases to allow the user to choose one
  149.       format over another, either because he disagrees with the
  150.       implementor's definition of "trivial" resource forks, or for
  151.       reasons of his own.
  152.  
  153.  
  154. 5.  AppleSingle
  155.  
  156.    An AppleSingle, version 2 file, is sent as one consecutive stream of
  157.    bytes.  The format is described in [APPL90] with a brief summary in
  158.    Appendix A. The one and only part of the file is sent in an
  159.    application/applefile message.
  160.  
  161.    The first four bytes of an AppleSingle header are, in hexadecimal:
  162.    00, 05, 16, 00.
  163.  
  164.    The AppleSingle file is binary data.  Hence, it may be necessary to
  165.    perform a Content-Transfer-Encoding for transmission.  The safest
  166.    encoding is Base64, since it permits transfer over the most
  167.  
  168. Faltstrom, Crocker, Fair                                        [Page 3]
  169.  
  170. Internet Draft            MIME-based Mac files          October 15, 1993
  171.  
  172.    restricted channels.
  173.  
  174.    Even though an AppleSingle file includes the original Macintosh
  175.    filename, it is recommended that a name parameter be included on the
  176.    Content-Type header to give the recipient a hint as to what file is
  177.    attached.  The value of the name parameter must consist of seven-bit
  178.    US-ASCII characters excluding SPACE, CTLS, and "tspecials" as
  179.    defined in RFC-1521 [BORE93].
  180.  
  181.  
  182.    5a.  AppleSingle example
  183.  
  184.       Content-Type: application/applefile; name="Computers-1/2-93"
  185.  
  186.           [The AppleSingle file goes here]
  187.  
  188.  
  189. 6.  AppleDouble
  190.  
  191.    An AppleDouble, version 2, file is divided in two parts:
  192.  
  193.    Header:      including the Macintosh resource fork and desktop
  194.                 information and
  195.    Data fork:   containing the Macintosh data fork.
  196.  
  197.    The AppleDouble format is described in [APPL90] with a brief summary
  198.    in Appendix B.
  199.  
  200.    The AppleDouble file itself is sent as a multipart/appledouble MIME
  201.    body-part, which may have only two sub-parts.  The header is sent as
  202.    application/applefile and the data fork as whatever best describes
  203.    it.  For example, is the data for is actually a GIF image, it should
  204.    be sent as image/gif.  If no appropriate Content-Type has been
  205.    registered for the data type, it should be sent as an
  206.    application/octet-stream.
  207.  
  208.    The first four bytes of an AppleDouble header are, in hexadecimal:
  209.    00, 05, 16, 07.
  210.  
  211.    The AppleDouble header is binary data.  Hence, it may be necessary
  212.    to perform a Content-Transfer-Encoding for transmission.  The safest
  213.    encoding is Base64, since it permits transfer over the most
  214.    restrictive channels.
  215.  
  216.    Even though an AppleDouble file includes the original Macintosh
  217.    filename, it is recommended that a name parameter be included on the
  218.    Content-Type header of both the header and data parts of the
  219.    AppleDouble file to give the recipient a hint as to what file is
  220.    attached.  The value of the name parameter must consist of seven-bit
  221.    US-ASCII characters excluding SPACE, CTLS, and "tspecials" as
  222.    defined in RFC-1521 [BORE93].
  223.  
  224.  
  225. Faltstrom, Crocker, Fair                                        [Page 4]
  226.  
  227. Internet Draft            MIME-based Mac files          October 15, 1993
  228.  
  229.    6a.  AppleDouble example
  230.  
  231.       Content-Type: multipart/appledouble; boundary=mac-part
  232.  
  233.       --mac-part
  234.       Content-Type: application/applefile; name="My-new-car"
  235.  
  236.           [The AppleDouble header goes here]
  237.  
  238.       --mac-part
  239.       Content-Type: image/gif;
  240.  
  241.           [The data fork goes here]
  242.  
  243.       --mac-part--
  244.  
  245.  
  246. 7.  References
  247.  
  248.    BORE93   Borenstein N., and N. Freed, MIME (Multipurpose Internet
  249.             Mail Extensions): Mechanisms for Specifying and Describing
  250.             the Format of Internet Message Bodies, RFC 1521, Bellcore,
  251.             Innosoft, September 1993.
  252.  
  253.    APPL90   AppleSingle/AppleDouble Formats for Foreign Files
  254.             Developer's Note, Apple Computer, Inc., 1990
  255.  
  256.  
  257. 8.  Security Considerations
  258.  
  259.    To the extent that application/applefile facilitates the
  260.    transmission of operating-system sensitive data, it may open a door
  261.    for easier relaxation of security rules than is intended either by
  262.    the sender of the administrator of the sender's system.
  263.  
  264.  
  265. 9.  Acknowledgements
  266.  
  267.    Thanks to all of the people on the ietf-822 list who have provided
  268.    much meaningful input for this document.  Some of them must though
  269.    be remembered by name, because they have almost crushed my mailbox
  270.    the last weeks with a very nice and interesting debate:
  271.  
  272.       Johan Berglund, Steve Dorner, David Gelhar, David Herron,
  273.       Raymond Lau, Jamey Maze, John B. Melby, Jan Michael Rynning,
  274.       Rens Troost, Peter Svanberg
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Faltstrom, Crocker, Fair                                        [Page 5]
  283.  
  284. Internet Draft            MIME-based Mac files          October 15, 1993
  285.  
  286. 10.  Authors Addresses
  287.    Patrik Faltstrom
  288.    Department of Numerical Analysis and Computing Science
  289.    Royal Institute of Technology
  290.    S-100 44 Stockholm
  291.    Sweden
  292.  
  293.    Email: paf@nada.kth.se
  294.  
  295.    Dave Crocker
  296.    675 Spruce.  Dr.
  297.    Sunnyvale, CA 94086
  298.    USA
  299.  
  300.    Email: dcrocker@mordor.stanford.edu
  301.  
  302.    Erik E. Fair
  303.    Engineering Computer Operations
  304.    Apple Computer Inc.
  305.  
  306.    Email: fair@apple.com
  307.  
  308. Appendix A.  The AppleSingle format
  309.  
  310.    In the AppleSingle format, a file's contents and attributes are
  311.    stored in a single file in the foreign file system.  For example,
  312.    both forks of a Macintosh file, the Finder information, and an
  313.    associated comment are arranged in a single file with a simple
  314.    structure.
  315.  
  316.    An AppleSingle file consists of a header followed by one or more
  317.    data entries.  The header consists of several fixed fields and a
  318.    list of entry descriptors, each pointing to a data entry.  Each
  319.    entry is optional and may or may not appear in the file.
  320.     AppleSingle file header:
  321.  
  322.    Field               Length
  323.  
  324.    Magic number         4 bytes
  325.    Version number       4 bytes
  326.    Filler              16 bytes
  327.    Number of entries    2 bytes
  328.  
  329.     Entry descriptor for each entry:
  330.  
  331.    Entry ID             4 bytes
  332.    Offset               4 bytes
  333.    Length               4 bytes
  334.  
  335.    Byte ordering in the file fields follows MC68000 conventions, most
  336.  
  337. Faltstrom, Crocker, Fair                                        [Page 6]
  338.  
  339. Internet Draft            MIME-based Mac files          October 15, 1993
  340.  
  341.    significant byte first.  The fields in the header file follow the
  342.    conventions described in the following sections.
  343.  
  344.    Magic number
  345.       This field, modelled after the UNIX magic number feature,
  346.       specifies the file's format.  Apple has defined the magic number
  347.       for the AppleSingle format as $00051600 or 0x00051600.
  348.  
  349.    Version number
  350.       This field denotes the version of AppleSingle format in the event
  351.       the format evolves (more fields may be added to the header).  The
  352.       version described in this note is version $00020000 or
  353.       0x00020000.
  354.  
  355.    Filler
  356.       This field is all zeros ($00 or 0x00).
  357.  
  358.    Number of entries
  359.       This field specifies how many different entries are included in
  360.       the file.  It is an unsigned 16-bit number.  If the number of
  361.       entries is any number other than 0, then that number of entry
  362.       descriptors immediately follows the number of entries field.
  363.  
  364.    Entry descriptors
  365.       The entry descriptor is made up of the following three fields:
  366.       Entry ID:   an unsigned 32-bit number, defines what the entry is.
  367.                   Entry IDs range from 1 to $FFFFFFFF. Entry ID 0 is
  368.                   invalid.
  369.       Offset:     an unsigned 32-bit number, shows the offset from the
  370.                   beginning of the file to the beginning of the entry's
  371.                   data.
  372.       Length:     an unsigned 32-bit number, shows the length of the
  373.                   data in bytes.  The length can be 0.
  374.  
  375.    Predefined entry ID's
  376.       Apple has defined a set of entry IDs and their values as follows:
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Faltstrom, Crocker, Fair                                        [Page 7]
  395.  
  396. Internet Draft            MIME-based Mac files          October 15, 1993
  397.  
  398.  
  399.       Data Fork              1 Data fork
  400.       Resource Fork          2 Resource fork
  401.       Real Name              3 File's name as created on home file
  402.                                system
  403.       Comment                4 Standard Macintosh comment
  404.       Icon, B&W              5 Standard Macintosh black and white icon
  405.       Icon, Colour           6 Macintosh colour icon
  406.       File Dates Info        8 File creation date, modification date,
  407.                                and so on
  408.       Finder Info            9 Standard Macintosh Finder information
  409.       Macintosh File Info   10 Macintosh file information, attributes
  410.                                and so on
  411.       ProDOS File Info      11 ProDOS file information, attributes and
  412.                                so on
  413.       MS-DOS File Info      12 MS-DOS file information, attributes and
  414.                                so on
  415.       Short Name            13 AFP short name
  416.       AFP File Info         14 AFP file, information, attributes and so
  417.                                on
  418.       Directory ID          15 AFP directory ID
  419.       Apple reserves the range of entry IDs from 1 to $7FFFFFFF. The
  420.       rest of the range is available for applications to define their
  421.       own entries.  Apple does not arbitrate the use of the rest of the
  422.       range.
  423.  
  424.  
  425. Appendix B.  The AppleDouble format
  426.  
  427.    The AppleDouble format uses two files to store data, resources and
  428.    attributes.  The AppleDouble Data file contains the data fork and
  429.    the AppleDouble Header file contains the resource fork.
  430.  
  431.    The AppleDouble Data file contains the standard Macintosh data fork
  432.    with no additional header.  The AppleDouble Header file has exactly
  433.    the same format as the AppleSingle file, except that it does not
  434.    contain a Data fork entry.  The magic number in the AppleDouble
  435.    Header file differs from the magic number in the AppleSingle Header
  436.    file so that an application can tell whether it needs to look in
  437.    another file for the data fork.  The magic number for the
  438.    AppleDouble format is $00051607 or 0x00051607.
  439.  
  440.    The entries in the AppleDouble Header file can appear in any order;
  441.    however, since the resource fork is the entry that is most commonly
  442.    extended (after the data fork), Apple recommends that the resource
  443.    fork entry to be placed last in the file.  The data fork is easily
  444.    extended because it resides by itself in the AppleDouble Data file.
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452. Faltstrom, Crocker, Fair                                        [Page 8]
  453.